package com.qf.area.controller;

import com.qf.area.entity.Area;
import com.qf.area.service.AreaService;
import com.qf.dto.PageDto;
import com.qf.vo.AreaVo;
import com.qf.vo.PageResult;
import com.qf.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 行政区划表 前端控制器
 * </p>
 *
 * @author xjj
 * @since 2023-10-31
 */
@RestController
@RequestMapping("/area")
@CrossOrigin
public class AreaController {
    @Autowired
    private AreaService areaService;

    /*查询所有省市区*/
    @GetMapping("findAll")
    public Result<List<AreaVo>> findAll(){
        return areaService.findAll();
    }

    /*分页查询*/
    @PostMapping("page")
    public PageResult<Area> page(@RequestBody PageDto<Area> pageDto){
        return areaService.pageInfo(pageDto);
    }

}
